__all__=["Cube"]
from mesh import Mesh
import vector
from bbox import *

class Cube(Mesh):
    """A Cube of side length 2 centered at the origin."""
    face = [[3, 2, 1, 0], [7, 6, 2, 3], [4, 5, 6, 7],
            [0, 1, 5, 4], [1, 2, 6, 5], [3, 0, 4, 7] ]
    vertex = [[-1, -1,1],[-1, -1,-1], [-1,1,-1], [-1,1,1], 
              [1, -1,1],[1, -1,-1], [1, 1,-1], [1,1,1]]
    def __init__(self, size=1.0,
                 drawmode="fill",normalmode="face",
                 material=None,transformation=None):
        """Constructor.
        @param drawmode: may be either "fill", meaning 
           that faces will be drawn filled, "line", meaning that only edges will
           be drawn, or "both", meaning both fill and line rendering. 
        @param normalmode: may be either "face" meaning one normal per face, or 
           "vertex", meaning that normals will be smoothed per vertex.
        @param material: the material object (Material). If None, means that
          no material is attached to this object and thus it will be rendered
          with the current material.
        @param transformation: a transformation (16-float vector). If None, 
          then an identity transformation is meant.
        """
        Mesh.__init__(self, self.face, 
                            [vector.scale (x, size) for x in self.vertex], 
                            drawmode, normalmode,
                            material, transformation)

if __name__=="__main__":
    # A simple test
    cube = Cube(3)
